package com.mask.mk.config.mpsConfig;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * @author: Joey
 * @Description:
 * @date:2023/4/25 14:22
 */
@Component
public class MyMetaObjectHandler implements MetaObjectHandler {

    @Override
    public void insertFill(MetaObject metaObject) {
//        CurrentUser user = new CurrentUser();
        this.setFieldValByName("createTime", LocalDateTime.now(),metaObject);
//        this.setFieldValByName("createId", user.getCurrentUser(),metaObject);
        this.setFieldValByName("updateTime", LocalDateTime.now(),metaObject);
    }

    @Override
    public void updateFill(MetaObject metaObject) {
//        CurrentUser user = new CurrentUser();
//        this.setFieldValByName("updateId", user.getCurrentUser(),metaObject);
        this.setFieldValByName("updateTime", LocalDateTime.now(),metaObject);
    }
}
